/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.quality4spl.fm.cvm.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.quality4spl.fm.cvm.CvmPackage;
import org.quality4spl.fm.cvm.VariabilityModelEntry;
import org.quality4spl.fm.cvm.VariabilityModelFolder;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Variability Model Folder</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.quality4spl.fm.cvm.impl.VariabilityModelFolderImpl#getChildEntries <em>Child Entries</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class VariabilityModelFolderImpl extends VariabilityModelEntryImpl implements VariabilityModelFolder {
	/**
	 * The cached value of the '{@link #getChildEntries() <em>Child Entries</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getChildEntries()
	 * @generated
	 * @ordered
	 */
	protected EList<VariabilityModelEntry> childEntries;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected VariabilityModelFolderImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CvmPackage.Literals.VARIABILITY_MODEL_FOLDER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<VariabilityModelEntry> getChildEntries() {
		if (childEntries == null) {
			childEntries = new EObjectContainmentWithInverseEList<VariabilityModelEntry>(VariabilityModelEntry.class, this, CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES, CvmPackage.VARIABILITY_MODEL_ENTRY__PARENT_FOLDER);
		}
		return childEntries;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildEntries()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES:
				return ((InternalEList<?>)getChildEntries()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES:
				return getChildEntries();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES:
				getChildEntries().clear();
				getChildEntries().addAll((Collection<? extends VariabilityModelEntry>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES:
				getChildEntries().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CvmPackage.VARIABILITY_MODEL_FOLDER__CHILD_ENTRIES:
				return childEntries != null && !childEntries.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //VariabilityModelFolderImpl
